#!/usr/bin/python3.4
# -*- coding=utf-8 -*-
#本脚由亁颐堂现任明教教主编写，用于乾颐盾Python课程！
#教主QQ:605658506
#亁颐堂官网www.qytang.com
#乾颐盾是由亁颐堂现任明教教主开发的综合性安全课程
#包括传统网络安全（防火墙，IPS...）与Python语言和黑客渗透课程！

import logging
logging.getLogger("scapy.runtime").setLevel(logging.ERROR)#清除报错
from scapy.all import *
import time

def calTSN(tgt):
    seqNum = 0
	preNum = 0
	diffSeq = 0
	seqList = []
	for x in range(1,10):
		if preNum != 0:
			preNum = seqNum
		pkt = IP(dst = tgt)/TCP()
		ans = sr1(pkt, verbose = 0)
		seqNum = ans.getlayer(TCP).seq
		diffSeq = seqNum - preNum
		if x > 1:
			seqList.append(diffSeq)
	print(seqList)
	avNum = sum(seqList)/len(seqList)
	print('平均值为:' + str(avNum))

if __name__ == '__main__':
	calTSN('202.100.1.102')

================================================================================
已经很难预测了，误差很大！！！
[root@Fedora hacker]# ./计算序列号.py
[436964180, 437011174, 437086216, 437111414, 437159804, 437178256, 437206230, 437254251]
平均值为:437121440.625
[root@Fedora hacker]# ./计算序列号.py
[437644346, 437672637, 437719140, 437749861, 437804395, 437824092, 437850174, 437896779]
平均值为:437770178.0
[root@Fedora hacker]# ./计算序列号.py
[438348470, 438369485, 438430033, 438446863, 438465962, 438511938, 438536963, 438585857]
平均值为:438461946.375
[root@Fedora hacker]# ./计算序列号.py
[439026415, 439050493, 439081583, 439141626, 439160206, 439215714, 439241897, 439259593]
平均值为:439147190.875
[root@Fedora hacker]# ./计算序列号.py
[439679993, 439710602, 439731882, 439780385, 439801296, 439848148, 439877346, 439907270]
平均值为:439792115.25